<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>变量的解构赋值</title>
</head>
<body>
	<p>数组的解构赋值</p>
	<script>
		var a = 1;
		var b = 2;
		var c = 3;
		// es6
		{
			let [a,b,c] = [4,5,6];
			console.log(a);
			console.log(b);
			console.log(c);
		}

		{
			let [foo,[[bar],baz]] = [1,[[2],3]];
			console.log(foo);
			console.log(typeof foo); //number
		}

		{
			let [ , , third] = [1,2,3];
			console.log(third);
		}

		{
			let [head, ...tail] = [1, 2, 3, 4];
			console.log(head);
			console.log(tail);
		}

		{
			let [foo] = [];
		}
	</script>
</body>
</html>